package com.yuanfengPlus.basicInfoManage.warehouseinfo.contorller;


import com.yuanfengPlus.basicInfoManage.warehouseinfo.model.WarehouseDTO;
import com.yuanfengPlus.basicInfoManage.warehouseinfo.model.Warehouseinfo;
import com.yuanfengPlus.basicInfoManage.warehouseinfo.service.impl.WarehouseinfoImpl;
import com.yuanfengPlus.utils.PageResult;
import com.yuanfengPlus.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.Map;


@CrossOrigin
@RestController
@Slf4j
@Api(tags = "仓库信息管理")
public class WarehouseCon {
    @Autowired
    WarehouseinfoImpl whsi;

    /**
     * 查询全部仓库信息
     * @param warehouseDTO
     * @return
     */
    @ApiOperation(value = "查询仓库信息")
    @PostMapping("/selectWarehouseAll")
    public Result<PageResult> selectWarehouseAll(@RequestBody WarehouseDTO warehouseDTO){
        return Result.success(whsi.selectWarehouseAll(warehouseDTO));
    }


    /**
     * 新增仓库信息
     * @param warehouseinfo
     * @return
     */
    @PostMapping("/addwarehouse")
    @ApiOperation(value = "新增仓库信息")
    public Result addwarehouse(@RequestBody Warehouseinfo warehouseinfo){
        return whsi.addwarehouse(warehouseinfo);
    }

    /**
     * 修改仓库信息
     * @param warehouseinfo
     * @return
     */
    @PostMapping("/updatewarehouse")
    @ApiOperation(value = "修改仓库信息")
    public Result updatewarehouse(@RequestBody Warehouseinfo warehouseinfo){
        return whsi.updatewarehouse(warehouseinfo);
    }

    /**
     * 查询单个仓库全部信息
     * @param id
     * @return
     */
    @PostMapping("/selectwsinfo")
    @ApiOperation(value = "查询单个仓库全部信息")
    public Result selectwsinfo(String id){
        return whsi.selectwsinfo(id);
    }


    /**
     * 批量删除仓库信息
     * @param warehouse_ID
     * @return
     */
    @PostMapping("/deletewarehouse")
    @ApiOperation(value = "批量删除仓库信息")
    public Result deletewarehouse(@RequestBody String[] warehouse_ID){
        return whsi.deletewarehouse(warehouse_ID);
    }




}
